﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;

namespace Gundam_2._0_Alpha.src
{
    public class FinishMission:IDrawAction
    {
        private Character c;
        private Sprite text;
        private Timer timer = Core.CreateTimer();


        private bool endMission()
        {
            if (c.Health <= 0)
                return true;
            return false;
        }
                

        public FinishMission(Character c, string imagePath)
        {
            this.c = c;
            text = Sprites.CreateSprite(Resources.LoadBitmap(imagePath));
            text.X = GlobalConst.ScreenWidth / 2 - text.Width / 2;
            text.Y = -text.Height;

        }

        public void DoAction(GameController gc)
        {
            if (!endMission()) return;

            if (Core.TimerTicks(timer) == 0)
                Core.StartTimer(timer);
            if (text.Y < GlobalConst.ScreenHeight /2 - text.Height/2)
                text.Y += 5;
            if (Core.TimerTicks(timer) > 15000)
            {
                Music.Stop();
                gc.GameStages.Pop();
            }
        }

        public void Draw()
        {
            text.Draw();
        }
    }
}
